package com.ae.shield.common.enchantment.shieldSuffix;

import net.minecraft.enchantment.Enchantment;

import javax.annotation.Nonnull;

public class LowPressure extends SuffixBase {
    public LowPressure() {
        super(new SuffixRate()
                .upper(-0.4f, 1)
                .penalty(1f, 1)
                .close(-0.2f, 1)
                .remote(-0.2f, 1)
                .magic(-0.2f, 1)
                .other(-0.2f, 1)
                .recovery(0.2f, 1)
                .cd(-0.5f, 1));
    }

    @Override
    public float levelRate(int level, SuffixProperty property, float rate) {
        switch (property) {
            case CLOSE:
            case REMOTE:
            case MAGIC:
            case OTHER:
            case CD:
                return rate + (level - 1f) * -0.15f;
            case PENALTY:
                return rate + (level - 1f) * 0.15f;
            case RECOVERY:
                return rate + (level - 1f) * 0.25f;
            default:
                return rate;
        }
    }

    @Override
    protected boolean canApplyTogether(@Nonnull Enchantment enchantment) {
        return enchantment != SuffixList.HIGH_PRESSURE.get() && super.canApplyTogether(enchantment);
    }
}
